﻿using System;
using System.Text;
using System.Data;
using System.Collections.Generic;
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.VisualStudio.Package;
using Babel.Parser;

namespace Babel
{
    public partial class Configuration
    {
        public const string Name = "UMC";
        public const string Extension = ".UMC";
        public const string FormatList = "UMC File (*.UMC)\n*.UMC";

        static CommentInfo myCInfo;
        public static CommentInfo MyCommentInfo { get { return myCInfo; } }

        static Configuration()
        {
            //myCInfo.BlockEnd = "*/";
            //myCInfo.BlockStart = "/*";

            //velocity multiple line comments
            myCInfo.BlockEnd = "*#";
            myCInfo.BlockStart = "#*";

            //??velocity line comments
            myCInfo.UseLineComments = true;
            myCInfo.LineStart = "##";

            //myCInfo.LineStart = "??";


            /*new version color define*/
            TokenColor VTL_Keyword = CreateColor("VTL-Keyword", COLORINDEX.CI_BLUE, COLORINDEX.CI_USERTEXT_BK); 
            TokenColor VTL_Reference = CreateColor("VTL-Reference", COLORINDEX.CI_AQUAMARINE, COLORINDEX.CI_USERTEXT_BK); 
            TokenColor VTL_Property = CreateColor("VTL-Property", COLORINDEX.CI_SYSPLAINTEXT_FG, COLORINDEX.CI_USERTEXT_BK); 
            TokenColor VTL_Comment = CreateColor("VTL-Comment", COLORINDEX.CI_DARKGREEN, COLORINDEX.CI_USERTEXT_BK);   
            TokenColor VTL_String = CreateColor("VTL-String", COLORINDEX.CI_RED, COLORINDEX.CI_USERTEXT_BK);          
            TokenColor VTL_Number = CreateColor("VTL-Number", COLORINDEX.CI_SYSPLAINTEXT_FG, COLORINDEX.CI_USERTEXT_BK);      
            TokenColor VTL_Text = CreateColor("VTL-Text", COLORINDEX.CI_SYSPLAINTEXT_FG, COLORINDEX.CI_USERTEXT_BK);   
  
            TokenColor UMC_Keyword = CreateColor("UMC-Keyword", COLORINDEX.CI_BLUE, COLORINDEX.CI_USERTEXT_BK);
            TokenColor UMC_Element = CreateColor("UMC-Element", COLORINDEX.CI_MAROON, COLORINDEX.CI_USERTEXT_BK);
            TokenColor UMC_Attribute = CreateColor("UMC-Attribute", COLORINDEX.CI_RED, COLORINDEX.CI_USERTEXT_BK);
            TokenColor UMC_AttrValue = CreateColor("UMC-AttrValue", COLORINDEX.CI_BLUE, COLORINDEX.CI_USERTEXT_BK);
            TokenColor UMC_Comment = CreateColor("UMC-Comment", COLORINDEX.CI_DARKGREEN, COLORINDEX.CI_USERTEXT_BK);
            TokenColor UMC_Text = CreateColor("UMC-Text", COLORINDEX.CI_SYSPLAINTEXT_FG, COLORINDEX.CI_USERTEXT_BK); 



            /*velocity comments*/
            ColorToken((int)Tokens.COMMENT, TokenType.Comment, VTL_Comment, TokenTriggers.None);
            /*velocity string literal*/
            ColorToken((int)Tokens.STRING_LITERAL, TokenType.String, VTL_String, TokenTriggers.None);
            /*velocity integer literal*/
            ColorToken((int)Tokens.INTEGER_LITERAL, TokenType.Text, VTL_Number, TokenTriggers.None);
            /*velocity float literal*/
            ColorToken((int)Tokens.FLOATING_POINT_LITERAL, TokenType.Text, VTL_Number, TokenTriggers.None);
            /*velocity '$'  */
            ColorToken((int)Tokens.DOLLAR, TokenType.Identifier, VTL_Reference, TokenTriggers.MemberSelect);
            /*velocity IDENTIFIER  */
            ColorToken((int)Tokens.IDENTIFIER, TokenType.Identifier, VTL_Reference, TokenTriggers.None);
            /*velocity PROPERTY  */
            ColorToken((int)Tokens.PROPERTY, TokenType.Text, VTL_Property, TokenTriggers.None);

            ColorToken((int)Tokens.MINUS, TokenType.Text, VTL_Text, TokenTriggers.None);
            ColorToken((int)Tokens.PLUS, TokenType.Text, VTL_Text, TokenTriggers.None);
            ColorToken((int)Tokens.MULTIPLY, TokenType.Text, VTL_Text, TokenTriggers.None);
            ColorToken((int)Tokens.DIVIDE, TokenType.Text, VTL_Text, TokenTriggers.None);
            ColorToken((int)Tokens.MODULUS, TokenType.Text, VTL_Text, TokenTriggers.None);
            ColorToken((int)Tokens.LOGICAL_AND, TokenType.Text, VTL_Text, TokenTriggers.None);
            ColorToken((int)Tokens.LOGICAL_OR, TokenType.Text, VTL_Text, TokenTriggers.None);
            ColorToken((int)Tokens.LOGICAL_LT, TokenType.Text, VTL_Text, TokenTriggers.None);
            ColorToken((int)Tokens.LOGICAL_LE, TokenType.Text, VTL_Text, TokenTriggers.None);
            ColorToken((int)Tokens.LOGICAL_GT, TokenType.Text, VTL_Text, TokenTriggers.None);
            ColorToken((int)Tokens.LOGICAL_GE, TokenType.Text, VTL_Text, TokenTriggers.None);
            ColorToken((int)Tokens.LOGICAL_EQUALS, TokenType.Text, VTL_Text, TokenTriggers.None);
            ColorToken((int)Tokens.LOGICAL_NOT_EQUALS, TokenType.Text, VTL_Text, TokenTriggers.None);
            ColorToken((int)Tokens.LOGICAL_NOT, TokenType.Text, VTL_Text, TokenTriggers.None);
            ColorToken((int)Tokens.EQUALS, TokenType.Text, VTL_Text, TokenTriggers.None);



            /*velocity true or false*/
            /*velocity 'true'*/
            ColorToken((int)Tokens.TRUE, TokenType.Keyword, VTL_Keyword, TokenTriggers.None);
            /*velocity 'false'*/
            ColorToken((int)Tokens.FALSE, TokenType.Keyword, VTL_Keyword, TokenTriggers.None);
            /*velocity '#'*/
            ColorToken((int)Tokens.KWSHARP, TokenType.Keyword, VTL_Keyword, TokenTriggers.MemberSelect);
            /*velocity 'set'*/
            ColorToken((int)Tokens.KWSET, TokenType.Keyword, VTL_Keyword, TokenTriggers.None);
            /*velocity 'if' etc*/
            ColorToken((int)Tokens.KWIF, TokenType.Keyword, VTL_Keyword, TokenTriggers.MatchBraces);
            ColorToken((int)Tokens.KWELSEIF, TokenType.Keyword, VTL_Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWELSE, TokenType.Keyword, VTL_Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWEND, TokenType.Keyword, VTL_Keyword, TokenTriggers.MatchBraces );
            ColorToken((int)Tokens.KWFOREACH, TokenType.Keyword, VTL_Keyword, TokenTriggers.MatchBraces );
            ColorToken((int)Tokens.KWIN, TokenType.Keyword, VTL_Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWPARSE, TokenType.Keyword, VTL_Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWSTOP, TokenType.Keyword, VTL_Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWINCLUDE, TokenType.Keyword, VTL_Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWMACRO, TokenType.Keyword, VTL_Keyword, TokenTriggers.None);
 
            //velocity match braces
            /*velocity RPAREN  */
            ColorToken((int)Tokens.RPAREN, TokenType.Delimiter, VTL_Text, TokenTriggers.ParameterEnd | TokenTriggers.MatchBraces);
            /*velocity LPAREN  */
            ColorToken((int)Tokens.LPAREN, TokenType.Delimiter, VTL_Text, TokenTriggers.ParameterStart | TokenTriggers.MemberSelect | TokenTriggers.MatchBraces);
            ColorToken((int)Tokens.LCURLY, TokenType.Delimiter, VTL_Text, TokenTriggers.MemberSelect | TokenTriggers.MatchBraces);
            ColorToken((int)Tokens.RCURLY, TokenType.Delimiter, VTL_Text, TokenTriggers.MatchBraces);
            ColorToken((int)Tokens.LBRACKET, TokenType.Delimiter, VTL_Text, TokenTriggers.MemberSelect | TokenTriggers.MatchBraces);
            ColorToken((int)Tokens.RBRACKET, TokenType.Delimiter, VTL_Text, TokenTriggers.MatchBraces);
            ColorToken((int)Tokens.DQUOTE, TokenType.String, VTL_String, TokenTriggers.MemberSelect);
            ColorToken((int)Tokens.SQUOTE, TokenType.String, VTL_String, TokenTriggers.MemberSelect);
            ColorToken((int)Tokens.COMMA, TokenType.Delimiter, VTL_Text, TokenTriggers.ParameterNext);

            /*UMC Configure*/
            ColorToken((int)Tokens.STTAG1, TokenType.Delimiter, UMC_Keyword, TokenTriggers.MatchBraces);
            ColorToken((int)Tokens.STTAG2, TokenType.Delimiter, UMC_Keyword, TokenTriggers.MatchBraces);
            ColorToken((int)Tokens.EDTAG1, TokenType.Delimiter, UMC_Keyword, TokenTriggers.MemberSelect | TokenTriggers.MatchBraces);
            ColorToken((int)Tokens.EDTAG2, TokenType.Delimiter, UMC_Keyword, TokenTriggers.MatchBraces);


            ColorToken((int)Tokens.UMCElement, TokenType.Identifier, UMC_Element, TokenTriggers.MemberSelect);
            ColorToken((int)Tokens.UMCAttribute, TokenType.Identifier, UMC_Attribute, TokenTriggers.MemberSelect);
            ColorToken((int)Tokens.UMCDOLLAR, TokenType.String, UMC_AttrValue, TokenTriggers.MemberSelect);
            ColorToken((int)Tokens.DOT, TokenType.Text, VTL_Property, TokenTriggers.MemberSelect);

            ColorToken((int)Tokens.UMCAttrValue, TokenType.String, UMC_AttrValue, TokenTriggers.None);

            ColorToken((int)Tokens.UMCWHITE1, TokenType.Identifier, UMC_Text, TokenTriggers.None);
            ColorToken((int)Tokens.CDATASTART, TokenType.Keyword, UMC_Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.CDATAEND, TokenType.Keyword, UMC_Keyword, TokenTriggers.None);
        }
    }
}
